<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>删除节点</title>
	</head>
	<body>
		<button>删除</button>
		<ul>
			<li>熊大</li>
			<li>熊二</li>
			<li>光头强</li>
		</ul>
		<script type="text/javascript">
			var ul = document.querySelector('ul');
			var btn = document.querySelector('button');
			// 点击按钮删除元素
			btn.onclick = function(){
				if(ul.children.length == 0){
					this.disabled = true;
				}else{
					ul.removeChild(ul.children[0]);
				}				
			}
		</script>
	</body>
</html>
